package com.lxk.controller;


import com.lxk.pojo.Activity;
import com.lxk.service.ActivityService;
import com.lxk.vo.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 活动 前端控制器
 * </p>
 *
 * @author JohnSoybean
 * @since 2020-07-14
 */
@RestController
@RequestMapping("/activity")
public class ActivityController {

    @Autowired
    private ActivityService activityService;

    /**
     * 获取活动列表
     * @return
     */
    @GetMapping("/list")
    public Result<List<Activity>> getActivityList() {
        List<Activity> list = activityService.list();
        return Result.success(list);
    }

    /**
     * 获取活动
     * @return
     */
    @GetMapping("/get")
    public Result<Activity> getActivity(Long activityId) {
        Activity activity = activityService.getById(activityId);
       return Result.success(activity);
    }

}

